package com.springboot.template.thread.sleep;

public class Test {
    public static void main(String[] args) {
        Long start = System.currentTimeMillis();
        System.out.println("System.currentTimeMillis() start = " + start);
        try {
            Thread.sleep(3 * 1000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        Long end = System.currentTimeMillis();
        System.out.println("System.currentTimeMillis() end = " + end);
        //因为线程的调度是不可控的，所以，这个方法只能保证实际休眠时间是大于等于参数设置的休眠时间的。
        System.out.println("delta = " + (end - start));
        /**
         * System.currentTimeMillis() start = 1739319497633
         * System.currentTimeMillis() end = 1739319500635
         * delta = 3002
         */
    }
}
